﻿using Houtel.IBll;
using Houtel.Model;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;

namespace Houtel.API.Controllers
{
    [Route("api/[controller]/[action]")]
    [ApiController]
    public class UserController : ControllerBase
    {
        private readonly IUserBll bll;

        public UserController(IUserBll bll)
        {
            this.bll = bll;
        }
        /// <summary>
        /// 列表
        /// </summary>
        /// <param name="uname"></param>
        /// <param name="date"></param>
        /// <param name="time"></param>
        /// <param name="usex"></param>
        /// <returns></returns>
        [HttpGet]
        public IQueryable<UserInfo> GetList(string? uname, DateTime? date, DateTime? time, string? usex)
        {
            try
            {
               return bll.GetList(uname, date, time, usex);
            }
            catch (Exception)
            {

                throw;
            }

        }
        /// <summary>
        /// 登录
        /// </summary>
        /// <param name="Uzhang"></param>
        /// <param name="upwd"></param>
        /// <returns></returns>
        [HttpGet]
        public async Task<dynamic> Login(string Uzhang, string upwd)
        {
            try
            {
                return await bll.Login(Uzhang, upwd);
            }
            catch (Exception)
            {

                throw;
            }

        }
    }
}
